package com.minis.beans.factory.config;

import com.minis.beans.factory.config.ArgumentValues;
import com.minis.beans.PropertyValues;

/**
 * 功能描述
 *
 * @author wanghongqian
 * @date 2023/06/02 23:07
 */
public class BeanDefinition {
    private static final String SCOPE_SINGLETON = "singleton";

    private static final String SCOPE_PROTOTYPE = "prototype";

    private boolean lazyInit = false;

    private String[] dependsOn;

    private ArgumentValues constructorArgumentValues;

    private PropertyValues propertyValues;

    private String initMethodName;

    private volatile Object beanClass;

    private String id;

    private String className;

    private String scope = SCOPE_SINGLETON;

    public BeanDefinition(String id, String className) {
        this.id = id;
        this.className = className;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getClassName() {
        return className;
    }

    public void setClassName(String className) {
        this.className = className;
    }

    public boolean isSingleton(){
        return scope.equals(SCOPE_SINGLETON);
    }

    public boolean isPrototype(){
        return scope.equals(SCOPE_PROTOTYPE);
    }

    public ArgumentValues getConstructorArgumentValues() {
        return constructorArgumentValues;
    }

    public void setConstructorArgumentValues(ArgumentValues constructorArgumentValues) {
        this.constructorArgumentValues = constructorArgumentValues;
    }

    public PropertyValues getPropertyValues() {
        return propertyValues;
    }

    public void setPropertyValues(PropertyValues propertyValues) {
        this.propertyValues = propertyValues;
    }

    public String[] getDependsOn() {
        return dependsOn;
    }

    public void setDependsOn(String[] dependsOn) {
        this.dependsOn = dependsOn;
    }

    public String getInitMethodName() {
        return initMethodName;
    }

    public boolean isLazyInit() {
        return lazyInit;
    }
}
